home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Entertainment / luff stuff / luff⁄catch.c < prev    next >
Encoding:
Text File  |  1985-11-08  |  668 b   |  32 lines  |  [TEXT/MACA]

  1. # include "def.h"
  2.  
  3. /* Fetches patterns in the board and puts them in temporary strings */
  4. catch(x, y) int x, y;{
  5.     char *h, *v, *l, *r;
  6.     register int i;
  7.  
  8.     h = hvlr[0];
  9.     v = hvlr[1];
  10.     l = hvlr[2];
  11.     r = hvlr[3];
  12.  
  13.     for(i = -8; i <= 8; i++){
  14.         if((x + i >= 0) && (x + i < XZIZE))
  15.             *h++ = board[x + i][y];
  16.         else
  17.             *h++ = 'z';
  18.         if((y + i >= 0) && (y + i < YZIZE))
  19.             *v++ = board[x][y + i];
  20.         else
  21.             *v++ = 'z';
  22.         if((x + i >= 0) && (x + i < XZIZE) && (y + i >= 0) && (y + i < YZIZE))
  23.             *l++ = board[x + i][y + i];
  24.         else
  25.             *l++ = 'z';
  26.         if((x + i >= 0) && (x + i < XZIZE) && (y - i >= 0) && (y - i < YZIZE))
  27.             *r++ = board[x + i][y - i];
  28.         else
  29.             *r++ = 'z';
  30.     }
  31. }
  32.